<template>
<c-card>
  <el-button type="primary" @click="addHandle">新增</el-button>
  <el-table :data="tableData" stripe highlight-current-row>
    <el-table-column prop="code" label="代码"/>
    <el-table-column prop="name" label="名称"/>
    <el-table-column prop="sort" label="排序"/>
  </el-table>
</c-card>

  <add-update ref="addUpdateRef"></add-update>
</template>

<script setup>
import {ref} from "vue";
import CCard from "../../../c-components/c-card.vue";
import {GET} from "../../../api/index.js";
import AddUpdate from "./add-update.vue";

const tableData = ref([])
const addUpdateRef = ref(null)

// 获取所有股票信息
const getPageList = () => {
  GET("/futures/exchange/list", {
    orderField: 'sort',
    order: 'desc'
  }).then(res => {
    tableData.value = res.data
  }).catch(() => {
  })
}
getPageList()

const addHandle = () => {
  addUpdateRef.value.open()
}
</script>

<style lang="scss" scoped>
</style>
